package com.kgc.controller;

import com.kgc.entity.JudgeQuestion;
import com.kgc.service.JudgeQuestionService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Bankjudgequestion)表控制层
 *
 * @author unicorn
 * @since 2020-05-23 20:03:52
 */
@RestController
@RequestMapping("bankjudgequestion")
public class JudgeQuestionController {
    /**
     * 服务对象
     */
    @Resource
    private JudgeQuestionService judgeQuestionService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("selectOne")
    public JudgeQuestion selectOne(@RequestParam("id") Integer id) {
        return this.judgeQuestionService.queryById(id);
    }

    @GetMapping(value = "queryJudgeQuestion")
    public List<JudgeQuestion> queryJudgeQuestion(){
        return this.judgeQuestionService.queryJudgeQuestion();
    }

    @GetMapping(value = "queryAllByLimit")
    public List<JudgeQuestion> queryAllByLimit(@RequestParam("offset") Integer offset,@RequestParam("limit") Integer limit){
        return this.judgeQuestionService.queryAllByLimit(offset,limit);
    }

    @GetMapping(value = "deleteById")
    public Integer deleteById(@RequestParam("id") Integer id){
        return this.judgeQuestionService.deleteById(id);
    }

    @PostMapping(value = "insertJudgeQuestion")
    public Integer insertJudgeQuestion(@RequestBody JudgeQuestion judgeQuestion){
        return this.judgeQuestionService.insert(judgeQuestion);
    }

    @PostMapping(value = "updateJudgeQuestion")
    public Integer updateJudgeQuestion(@RequestBody JudgeQuestion judgeQuestion){
        return this.judgeQuestionService.update(judgeQuestion);
    }
}